package cn.edu.scau.cmi.front.dao;

import java.util.Set;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import cn.edu.scau.cmi.ema.dao.AbstractJpaDao;
import cn.edu.scau.cmi.ema.domain.Echart;
import cn.edu.scau.cmi.ema.domain.Event;

@Repository
@Transactional
public class CmiEchartDAOImpl extends AbstractJpaDao implements CmiEchartDAO {

	@PersistenceContext(unitName = "ema")
	private EntityManager entityManager;

//	@Override
	public EntityManager getEntityManager() {
		return entityManager;
	}

	@Override
	public boolean canBeMerged(Object o) {
		return false;
	}

	@Override
	public Event executeQueryByNameSingleResult(String queryName) {
		return null;
	}

	@Override
	public Event executeQueryByNameSingleResult(String queryName, Object... parameters) {
		return null;
	}

	@Override
	public Event executeQuerySingleResult(String queryString, Object... parameters) {
		return null;
	}

	@Override
	public Set getTypes() {
		return null;
	}

	@Override
	public Echart findLastEchart() {
		Query query = createNamedQuery("findLastEchart", -1, -1);
		return  (Echart) query.getSingleResult();
	}
}